package jp.dodododo.aop.interceptors;

import java.io.Serializable;

import jp.dodododo.aop.annotation.Enhance;

import org.apache.commons.lang.SerializationUtils;

/**
 * {@.en }
 * 
 * <br />
 * 
 * {@.ja }
 * 
 * @author Satoshi Kimura
 */
@Enhance(false)
public class CloneInterceptor extends TakeOverInterceptor {

	@Override
	public Object clone() {
		Object target = getThis();
		// knowingly ClassCastException
		Serializable serializable = (Serializable) target;
		byte[] bs = SerializationUtils.serialize(serializable);
		return SerializationUtils.deserialize(bs);
	}
}
